qui(
	function(require, exports, module){

        Server.Dao = $.extend({}, Ancestor.Dao, {
            getList: function (data, callback) {
                var options = {
                    type: "post",
                    url: "/api/sginal/server/list",
                    dataType: "json",
                    data: data,
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/list");
            },
            add: function (data, callback) {
                var options = {
                    type: "post",
                    url: "/api/sginal/server/create",
                    dataType: "json",
                    data: data,
                    success: function (rdata) {
                        var subdata = JSON.parse(data["entity"]);

                        if(subdata["serverType"] == 9){
                            Server.Dao.synVersion(subdata);
                        }

                        callback.call(this, rdata);

                    },
                    error: function (rdata) {
                        callback.call(this, rdata);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/create");
            },

            edit: function (data, callback) {
                var options = {
                    type: "post",
                    url: "/api/sginal/server/edit",
                    dataType: "json",
                    data: data,
                    success: function (rdata) {
                        var subdata = JSON.parse(data["entity"]);
                        if(subdata["serverType"] == 9){
                            Server.Dao.synVersion(subdata);
                        }
                        callback.call(this, rdata);

                    },
                    error: function (rdata) {
                        callback.call(this, rdata);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/edit");
            },
            delete: function (data, callback) {
                var options = {
                    type: "post",
                    url: "/api/sginal/server/delete",
                    dataType: "json",
                    data: data,
                    success: function (rdata) {
                        Server.Dao.delVersionController(data);
                        callback.call(this, rdata);
                    },
                    error: function (rdata) {
                        callback.call(this, rdata);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/delete");
            },
            checkInsideIp: function (data, callback) {
                var options = {
                    type: "post",
                    url: "/api/sginal/server/checkInsideServerIp",
                    dataType: "json",
                    data: data,
                    success: function (rdata) {
                        callback.call(this, rdata);
                    },
                    error: function (rdata) {
                        callback.call(this, rdata);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/checkInsideServerIp");
            },

            redirect: function(data, callback) {
                var options = {
                    url: '/api/redirect',
                    dataType: 'json',
                    data: data,
                    method: 'post',
                    success: function(data) {
                        callback.call(this, data);
                    },
                    error: function(data) {
                        callback.call(this, data);
                    }
                };
                Ancestor.Dao.ajax(options,'/redirect');
            },
            getZZDVersionList: function (data, callback) {
                var options = {
                    type: "post",
                    url: "/api/sginal/server/zzdServerList",
                    dataType: "json",
                    data: data,
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/zzdServerList");
            },

            versionHistory: function (data, callback) {
                var options = {
                    type: "post",
                    url: "/api/sginal/server/versionHistory",
                    dataType: "json",
                    data: data,
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/versionHistory");
            },

            synVersion : function(data,callback){
                var options = {
                    type: "post",
                    url: "/api/sginal/server/synVersion",
                    dataType: "json",
                    data: data,
                }
                Ancestor.Dao.ajax(options, "/sginal/server/synVersion");
            },

            delVersionController : function(data,callback){
                var options = {
                    type: "post",
                    url: "/api/sginal/server/delVersionController",
                    dataType: "json",
                    data: data,
                }
                Ancestor.Dao.ajax(options, "/sginal/server/delVersionController");
            },

            getMainVersion : function(data,callback){
                var options = {
                    type: "post",
                    url: "/api/sginal/server/getMainVersion",
                    dataType: "json",
                    data: data,
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/getMainVersion");
            },

            setMainVersion : function(data,callback){
                var options = {
                    type: "post",
                    url: "/api/sginal/server/setMainVersion",
                    dataType: "json",
                    data: data,
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/setMainVersion");
            },

            synVersionStatus : function(data,callback){
                var options = {
                    type: "post",
                    url: "/api/sginal/server/synVersionStatus",
                    dataType: "json",
                    data: data,
                    success: function (data) {
                        callback.call(this, data);
                    },
                    error: function (data) {
                        callback.call(this, data);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/synVersionStatus");
            },






            
            addCluster: function (data, callback) {
                var options = {
                    type: "post",
                    url: "/api/sginal/server/createServerCluster",
                    dataType: "json",
                    data: data,
                    success: function (rdata) {
                        callback.call(this, rdata);
                    },
                    error: function (rdata) {
                        callback.call(this, rdata);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/createServerCluster");
            },

            editCluster: function (data, callback) {
                var options = {
                    type: "post",
                    url: "/api/sginal/server/editServerCluster",
                    dataType: "json",
                    data: data,
                    success: function (rdata) {
                        callback.call(this, rdata);
                    },
                    error: function (rdata) {
                        callback.call(this, rdata);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/editServerCluster");
            },
            clusterList: function (data, callback) {
                var options = {
                    type: "post",
                    url: "/api/sginal/server/clusterList",
                    dataType: "json",
                    data: data,
                    success: function (rdata) {
                        callback.call(this, rdata);
                    },
                    error: function (rdata) {
                        callback.call(this, rdata);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/clusterList");
            },

            clusterServerList: function (data, callback) {
                var options = {
                    type: "post",
                    url: "/api/sginal/server/clusterSeverList",
                    dataType: "json",
                    data: data,
                    success: function (rdata){
                        callback.call(this, rdata);
                    },
                    error: function (rdata) {
                        callback.call(this, rdata);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/clusterSeverList");
            },

            delServerCluster: function (data, callback) {
                var options = {
                    type: "post",
                    url: "/api/sginal/server/delServerCluster",
                    dataType: "json",
                    data: data,
                    success: function (rdata) {
                        callback.call(this, rdata);
                    },
                    error: function (rdata) {
                        callback.call(this, rdata);
                    }
                }
                Ancestor.Dao.ajax(options, "/sginal/server/delServerCluster");
            },

        });
	}
);